import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
	plugins: [vue()],
	open: true, // 配置自动启动浏览器
	build: {
		chunkSizeWarningLimit: 1500,
		cssCodeSplit: false,
	},
	css: {
		preprocessorOptions: {
			scss: {
				charset: false,
			},
		},
		postcss: {
			plugins: [
				{
					postcssPlugin: 'internal:charset-removal',
					AtRule: {
						charset: (atRule) => {
							if (atRule.name === 'charset') {
								atRule.remove()
							}
						},
					},
				},
			],
		},
	},
	server: {
		proxy: {
			// http://10.100.128.224:5353/api  http://localhost:5000/api 'http://10.100.128.224:8003/api'
			'/api': {
				target: 'http://10.100.128.224:8003/api', //实际请求地址
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, ''),
			},
		},
	},
})
